From: Carlos Garnacho Date: Fri, 22 Apr 2022 14:19:14 +0000 (+0200) Subject: keyboard: Fill suggestion on button-press-event X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~17 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=aa341104e523afc75d77493002efef0fbea21a0d;p=gnome-shell.git keyboard: Fill suggestion on button-press-event Like OSK key buttons, we must avoid the default grabbing behavior of StButton here. Hook to button-press-event to commit the selected words, so we get a chance to prevent focus changes on the current key focus. Likewise, connect to ::touch-event to handle touch input. Part-of: --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 39066057a..e7b1eae4f 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -175,7 +175,17 @@ class Suggestions extends St.BoxLayout { add(word, callback) { let button = new St.Button({ label: word }); - button.connect('clicked', callback); + button.connect('button-press-event', () => { + callback(); + return Clutter.EVENT_STOP; + }); + button.connect('touch-event', (actor, event) => { + if (event.type() !== Clutter.EventType.TOUCH_BEGIN) + return Clutter.EVENT_PROPAGATE; + + callback(); + return Clutter.EVENT_STOP; + }); this.add_child(button); }